package file;

import java.io.File;
import java.io.IOException;

/**
 * @author liyang
 * @version 1.0
 * @package file
 * @file CreateNewFileDemo.java
 * @description
 * @time 2024-03-15 18:30
 */


public class CreateNewFileDemo {
    public static void main(String[] args) {
        File dir = new File("./demo");
        if(dir.exists()){
            System.out.println("目录存在");
        }else{
            dir.mkdir();
            System.out.println("目录已创建");
        }

        File file = new File("./fos.dat");
        if(file.exists()){
            System.out.println("文件存在");
        }else{
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }






    }
}
